<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>闭包的用途-私有变量计数器</title>
	<script type="text/javascript">
		
		var count = (function(){

				 	var a = 0;
				
					function bb()
					{
						a++;
						return a;
					}

					return bb;

		})();

		
		alert(count());

		alert(count());

		var c = count();

		alert(c);




	</script>
	
</head>
<body>
	
</body>
</html>